velaif820 2.2.0
Loading...
Searching...
No Matches
velaif820


Vela IF820 Click

Vela IF820 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.


Click Library

  • Author : Stefan Filipovic
  • Date : Nov 2024.
  • Type : UART type

Software Support

Example Description

This example demonstrates the use of Vela IF820 Click board by processing data from a connected BT Classic device.

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.VelaIF820

Example Key Functions

  • velaif820_cfg_setup Config Object Initialization function.
    void velaif820_cfg_setup(velaif820_cfg_t *cfg)
    Vela IF820 configuration object setup function.
    Vela IF820 Click configuration object.
    Definition velaif820.h:271
  • velaif820_init Initialization function.
    err_t velaif820_init(velaif820_t *ctx, velaif820_cfg_t *cfg)
    Vela IF820 initialization function.
    Vela IF820 Click context object.
    Definition velaif820.h:245
  • velaif820_cmd_set This function sends a specified set command to the Click module.
    void velaif820_cmd_set ( velaif820_t *ctx, uint8_t *cmd, uint8_t *params );
    void velaif820_cmd_set(velaif820_t *ctx, uint8_t *cmd, uint8_t *params)
    Vela IF820 cmd set function.
  • velaif820_cmd_get This function sends a specified get command to the Click module.
    void velaif820_cmd_get ( velaif820_t *ctx, uint8_t *cmd, uint8_t *params );
    void velaif820_cmd_get(velaif820_t *ctx, uint8_t *cmd, uint8_t *params)
    Vela IF820 cmd get function.
  • velaif820_read_packet This function reads a response or event packet from the Click module and stores it in ctx->evt_pkt structure.
    err_t velaif820_read_packet(velaif820_t *ctx)
    Vela IF820 read packet function.

Application Init

Initializes the driver and logger.

void application_init ( void )
{
log_cfg_t log_cfg;
velaif820_cfg_t velaif820_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
velaif820_cfg_setup( &velaif820_cfg );
VELAIF820_MAP_MIKROBUS( velaif820_cfg, MIKROBUS_1 );
if ( UART_ERROR == velaif820_init( &velaif820, &velaif820_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
app_state = VELAIF820_POWER_UP;
log_printf( &logger, ">>> APP STATE - POWER UP <<<\r\n\n" );
}
#define VELAIF820_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition velaif820.h:215
void application_init(void)
Definition main.c:151
@ VELAIF820_POWER_UP
Definition main.c:64

Application Task

Application task is split in few stages:

  • VELAIF820_POWER_UP:

    Powers up the device and checks the communication.

  • VELAIF820_CONFIG_EXAMPLE:

    Restores factory settings, sets BT Classic flags and reads the BT address and name.

  • VELAIF820_EXAMPLE:

    Performs a BT terminal example by processing all data from a connected BT Classic device and sending back an adequate response messages.

void application_task ( void )
{
switch ( app_state )
{
{
if ( VELAIF820_OK == velaif820_power_up( &velaif820 ) )
{
log_printf( &logger, ">>> APP STATE - CONFIG EXAMPLE <<<\r\n\n" );
}
break;
}
{
if ( VELAIF820_OK == velaif820_config_example( &velaif820 ) )
{
app_state = VELAIF820_EXAMPLE;
log_printf( &logger, ">>> APP STATE - EXAMPLE <<<\r\n\n" );
}
break;
}
{
velaif820_example( &velaif820 );
break;
}
default:
{
log_error( &logger, " APP STATE." );
break;
}
}
}
void application_task(void)
Definition main.c:184
@ VELAIF820_CONFIG_EXAMPLE
Definition main.c:65
@ VELAIF820_EXAMPLE
Definition main.c:66
@ VELAIF820_OK
Definition velaif820.h:298

Note

We have used the Serial Bluetooth Terminal smartphone application for the test. A smartphone and the Click board must be paired in order to exchange messages with each other.

Application Output

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
  • UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.

Additional Notes and Information

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.